package com.warren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.warren.dao.UserMapper;
import com.warren.dao.UserRepository;
import com.warren.entity.User;
import com.warren.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserRepository userRepository;

    @Autowired
    private UserMapper userMapper;

    @Override
    public void addUser(User user) {
        userRepository.save(user);
    }

    @Override
    public List<User> list() {
        return userRepository.findAll();
    }

    @Override
    public void testMybatisPlus() {
        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
        userMapper.selectList(userQueryWrapper);
    }
}
